/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.matrimonybeans;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;

/**
 *
 * @author hb
 */
@Stateless
public class Add_Servicess implements Add_ServicessLocal {
   Connection conn;
    boolean flag = false;

    @Override
    public Boolean AddServices(String select_edition, String post_your, BigDecimal payment) {
        try {
            ConnectDB conDB = new ConnectDB();
            conn = conDB.getConnection();
            String strSql = "Insert into Services(select_edition,post_your,payment) values(?,?,?)";
            PreparedStatement pstmt = conn.prepareStatement(strSql);
            
            pstmt.setString(1, select_edition);
            pstmt.setString(2,post_your);            
            pstmt.setBigDecimal(3, payment);
            
            //ResultSet rs = pstmt.executeQuery();
            int count = 0;
            count =  pstmt.executeUpdate();
            if (count > 0) {
                flag = true;
            } else {
                flag = false;
            }
        } catch (SQLException ex) {
            Logger.getLogger(Add_Servicess.class.getName()).log(Level.SEVERE, null, ex);
        }
        return flag;
    }

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")

}
